<?php
include_once('includes.php'); 
include_once('includes/rating.class.php');	

if(isset($_GET["id"]) && $_GET["id"]>0 )
{
	$id = (int) $_GET["id"];
	$sql = "select * from video where id=".addslashes($id);
	$video=db_fetch_one($sql);
	if(!$video)
	{
		Header("Location: /");
		exit;
	}
}	
else
{
	Header("Location: /");
	exit;
}

//-------------------------------------------
$page_title = $video->title;
?>

<?php include_once('includes/header.php'); 	 ?>


<h1 class="header"><?php echo $video->title;?></h1>

<span class="match-kickoff"><?php echo formatOutputDate($video->date_created); ?></span> <br/>


<div style="padding:10px 0">
	<!-- AddThis Button BEGIN -->
	<div class="addthis_toolbox addthis_default_style ">
		<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
		<a class="addthis_button_tweet"></a>
		<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>	
	</div>
	<script type="text/javascript" src="/js/addthis_widget.js"></script>
	<!-- AddThis Button END -->
</div>

<div class="clearfix">
	<?php echo $video->embed_code;?>
</div>
<div class="clearfix">
	<?php echo $video->description ;?>
</div>

<div class="social-share">
	<span class="text">Chia sẻ</span>
	<!-- AddThis Button BEGIN -->
	<div class="content">
		<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
			<a class="addthis_button_facebook"></a>
			<a class="addthis_button_google"></a>
			<a class="addthis_button_twitter"></a>
			<a class="addthis_button_compact"></a>
			<a class="addthis_counter addthis_bubble_style"></a>
		</div>
	</div>
	<!-- AddThis Button END -->
</div>


<!-- Start VIDEO -->

<div>

	<script src="/includes/scrollable/jquery.tools.min.js"></script> 
	<link rel="stylesheet" type="text/css" href="/includes/scrollable/scrollable-horizontal.css" /> 
	<link rel="stylesheet" type="text/css" href="/includes/scrollable/scrollable-buttons.css" /> 
	<link rel="stylesheet" type="text/css" href="/includes/scrollable/scrollable-navigator.css" /> 
	 
	<!-- wrapper for navigator elements --> 
	<div class="navi"></div> 
	 
	<!-- "previous page" action --> 
	<a class="prev browse left"></a> 
	<!-- root element for scrollable --> 
	<div class="scrollable" id=browsable>   
	   
	   <!-- root element for the items --> 
	   <div class="items"> 
			
				
			<?php
				$sql = "select  * from video where id<>".$id." order by date_created desc limit 50 ";
				$videos=db_fetch_all($sql);
				
				$i=0;	
				foreach($videos as $video)
				{
					$i++;
					if($i%5==1)
						echo "<div>";
						
					echo "<div class='item'> <a href='/video/".$video->id."-".clean_entities($video->title)."'><img src='".$video->thumb_image."' /> </a> <span class='title'>".$video->title."</span> </div>";
					
					if($i%5==0 || $i==count($videos))
						echo "</div>";
				}
			?>
		
		</div> 
	</div> 
	 
	<!-- "next page" action --> 
	<a class="next browse right"></a> 
	 
	 
	<br clear="all" /> 
	 
	<!-- javascript coding --> 
	<script> 
	// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
	$(document).ready(function() {
		$("#browsable").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({
			interval: 8000		
		});

	});
	</script> 

</div>

<!-- End VIDEO -->


<?php include_once('includes/footer.php'); 	 ?>